//
//  XAlertTool.m
//  Bees
//
//  Created by Xiaohan on 2018/12/20.
//  Copyright © 2018 xiaohan. All rights reserved.
//

#import "XAlertTool.h"
#import "LEEAlert.h"
@implementation XAlertTool
+ (void)alertTitle:(NSString*)title message:(NSString*)message cancelAction:(void(^)(void))cancelAction sureAction:(void(^)(void))sureAction{
    if (!cancelAction) {
        [LEEAlert alert].config
        .LeeAddTitle(^(UILabel *label) {
            label.text = XLocalized(title);
            label.textColor = UIColorHex(#333333);
            label.font = kDefaultFont(16);
        })
        .LeeAddContent(^(UILabel *label) {
            label.text = XLocalized(message);
            label.textColor = UIColorHex(#FFAE00);
            label.font = kDefaultFont(14);
        })
        .LeeItemInsets(UIEdgeInsetsMake(0, 0, 0, 0))
        .LeeAddAction(^(LEEAction *action) {
            action.type = LEEActionTypeDefault;
            action.title = XLocalized(@"确定");
            action.titleColor = kColorMain;
            action.font = kBoldFont(17);
            action.backgroundColor = [UIColor whiteColor];
            action.clickBlock = ^{
                // 删除点击事件Block
                !sureAction?:sureAction();
            };
        })
        .LeeHeaderColor([UIColor whiteColor])
        .LeeShow();
    }else{
        [LEEAlert alert].config
        .LeeAddTitle(^(UILabel *label) {
            label.text = XLocalized(title);
            label.textColor = UIColorHex(#333333);
            label.font = kDefaultFont(16);
        })
        .LeeAddContent(^(UILabel *label) {
            label.text = XLocalized(message);
            label.textColor = UIColorHex(#FFAE00);
            label.font = kDefaultFont(14);
        })
        .LeeItemInsets(UIEdgeInsetsMake(0, 0, 0, 0))
        .LeeAddAction(^(LEEAction *action) {
            action.type = LEEActionTypeCancel;
            action.title = XLocalized(@"取消");
            action.titleColor = kTitleColor;
            action.font = kBoldFont(17);
            action.backgroundColor = [UIColor whiteColor];
            action.clickBlock = ^{
                // 取消点击事件Block
                !cancelAction?:cancelAction();
            };
        })
        .LeeAddAction(^(LEEAction *action) {
            action.type = LEEActionTypeDefault;
            action.title = XLocalized(@"确定");
            action.titleColor = kColorMain;
            action.font = kBoldFont(17);
            action.backgroundColor = [UIColor whiteColor];
            action.clickBlock = ^{
                // 删除点击事件Block
                !sureAction?:sureAction();
            };
        })
        .LeeHeaderColor([UIColor whiteColor])
        .LeeShow();
    }
  
}
@end
